package com.youdianda.controller;

import com.youdianda.dto.SysConfigFgxDTO;
import com.youdianda.result.Result;
import com.youdianda.service.SysConfigFgxService;
import com.youdianda.vo.ConfigFgxVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = "权限管理")
@RequestMapping("/sys_config")
@RestController
public class SysConfigFgxController {

    @Autowired
    private SysConfigFgxService sysConfigService;

    /**
     * GET 获取系统配置
     * @return
     */
    @ApiOperation("GET 所有配置数据")
    @GetMapping("/all")
    public Result all(){
        Map map = sysConfigService.all();
        return Result.success(map);
    }

    /**
     * POST 增加配置
     * @return
     */
    @ApiOperation("POST 增加配置")
    @PostMapping("/add")
    public Result add(@RequestBody List<SysConfigFgxDTO> dtos){
        return Result.success("暂时没找到功能在哪");
    }

    /**
     * POST 更新
     * @return
     */
    @ApiOperation("POST 更新配置")
    @PostMapping("/update")
    public Result update(@RequestBody List<SysConfigFgxDTO> dtos){
        sysConfigService.update(dtos);
        return Result.success();
    }

}
